/**
 * @version v1.0
 * @description:
 * @author: admin
 * @date: 2022/12/12 15:26
 * @copyright: 博为峰
 */
public class ArrrayTest03 {
    public static void main(String[] args) {
        /*
           0
           0~1
           0~2
           0~3
        */
        //插入排序
        int[] arr = {20, 9, 15, 3, 26, 6, 11};
        int t = 0;
        for (int i = 1; i < arr.length; i++) {
            int start = i;
            while (start - 1 >= 0 && arr[start - 1] > arr[start]) {
                t = arr[start];
                arr[start] = arr[start - 1];
                arr[start - 1] = t;
                start--;
            }
        }

        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + ",");
        }


    }
}
